

public class Text{
    public static int missingNumber(int[] nums) {
        int n=nums.length,tmp1=n*(n+1)/2,tmp2=0;
        for(int i=0;i<n;i++){
            tmp2+=nums[i];
        }
        return tmp1-tmp2;
    }

    public static void main(String[] args) {
        int[]  nums={0,3,5,4,2,6,8,1};
        int ret=missingNumber(nums);
        System.out.println(ret);

    }
}